package com.netease.b.a;

import android.content.Context;
import android.net.DhcpInfo;
import android.net.wifi.WifiManager;
import com.netease.framework.a.m;
import com.netease.framework.b.a;
import com.netease.g.b;
import com.netease.pris.protocol.PRISFbResultInfo;
import java.net.InetAddress;
import org.json.JSONException;
import org.json.JSONObject;

public class af extends a
{
  private long a;
  private String b;
  private String c;
  private boolean d;
  private String e;
  private String f;
  private int g = 0;
  private final int i;
  private final int j;
  private final int k;

  protected af(String paramString1, String paramString2, String paramString3, boolean paramBoolean)
  {
    super(2200);
    this.i = m;
    this.j = 2;
    this.k = 3;
    this.a = 16029L;
    this.b = paramString1;
    this.c = paramString2;
    this.d = paramBoolean;
    if (this.d);
    while (true)
    {
      this.g = m;
      this.f = paramString3;
      return;
      m = 2;
    }
  }

  private static String a(int paramInt)
  {
    return (paramInt & 0xFF) + "." + (0xFF & paramInt >> 8) + "." + (0xFF & paramInt >> 16) + "." + (0xFF & paramInt >> 24);
  }

  private void a()
  {
    try
    {
      InetAddress[] arrayOfInetAddress = InetAddress.getAllByName("cdn.easyread.163.com");
      if (arrayOfInetAddress != null)
      {
        int m = arrayOfInetAddress.length;
        n = 0;
        if (n < m)
        {
          InetAddress localInetAddress = arrayOfInetAddress[n];
          if (localInetAddress == null)
            break label170;
          b.b("cdn ip", "" + localInetAddress.getHostAddress());
          break label170;
        }
      }
      WifiManager localWifiManager = (WifiManager)d.h().a().getSystemService("wifi");
      if (localWifiManager != null)
      {
        DhcpInfo localDhcpInfo = localWifiManager.getDhcpInfo();
        if (localDhcpInfo != null)
        {
          b.b("dns1", a(localDhcpInfo.dns1));
          b.b("dns2", a(localDhcpInfo.dns2));
          b.b("ipAddress", a(localDhcpInfo.ipAddress));
          b.b("serverAddress", a(localDhcpInfo.serverAddress));
          b.b("gateway", a(localDhcpInfo.gateway));
        }
      }
      return;
    }
    catch (Exception localException)
    {
      while (true)
      {
        int n;
        localException.printStackTrace();
        continue;
        label170: n++;
      }
    }
  }

  public void a(int paramInt, Object paramObject)
  {
    String str = (String)paramObject;
    if (this.d)
      if (this.g != 1);
    do
    {
      do
        try
        {
          localJSONObject = new JSONObject(str);
          if (localJSONObject.optBoolean("success"))
          {
            this.e = localJSONObject.optString("fileId");
            this.g = 2;
            if (this.g != 3)
              g().a(this);
            return;
          }
        }
        catch (JSONException localJSONException)
        {
          while (true)
          {
            localJSONException.printStackTrace();
            JSONObject localJSONObject = null;
            continue;
            this.g = 3;
          }
        }
      while (this.g != 2);
      if (str.equals("true"))
        c(0, new PRISFbResultInfo("success"));
      while (true)
      {
        this.g = 3;
        break;
        c(0, new PRISFbResultInfo("failed"));
      }
    }
    while (n() != 2);
    if (str.equals("true"))
      c(0, new PRISFbResultInfo("success"));
    while (true)
    {
      this.g = 3;
      break;
      c(0, new PRISFbResultInfo("failed"));
    }
  }

  protected void b(int paramInt, Object paramObject)
  {
    d(paramInt, paramObject);
  }

  public void c()
  {
    m localm = null;
    if (this.d)
      if (this.g == 1)
      {
        a();
        localm = com.netease.pris.protocol.c.c();
      }
    while (true)
    {
      a(localm);
      return;
      if (this.g != 2)
        continue;
      localm = com.netease.pris.protocol.c.a(this.a, this.f, this.b, this.c, this.e);
      continue;
      localm = com.netease.pris.protocol.c.a(this.a, this.f, this.b, this.c, this.e);
    }
  }
}

/* Location:           D:\android\hack\dex2jar-0.0.9.8\classes_dex2jar.jar
 * Qualified Name:     com.netease.b.a.af
 * JD-Core Version:    0.6.0
 */